import { Convertor } from "./Convertor.js";
import { program } from 'commander'

interface Option {
    projectRoot: string
    ruleFile?: string
}

const rmQuotes = (val: string): string => {
    const rst = val.match(/(['"])(.+)\1/)
    if (rst != null) return rst[2]
    return val
}

program.option('-p, --projectRoot <path>', '[MUST] the unity project root', rmQuotes)
program.option('-r, --ruleFile <path>', 'the replace rule file', rmQuotes)
    .parse(process.argv)
const opts = program.opts<Option>()
console.log('options:', opts)

const cvt = new Convertor()
await cvt.start(opts.projectRoot, opts.ruleFile)
